from netmiko import ConnectHandler

with open('ip_list.txt') as f:
    for ips in f.readlines():
        ip = ips.strip()
        connection_info = {
                'device_type': 'cisco_ios',
                'ip': ip,
                'username': 'admin',
                'password': 'admin',
        }
        with ConnectHandler(**connection_info) as connect:
            print (f'已经成功登陆交换机{ip}')
            output = connect.send_command('display  interface vlan')
            print(output)